<template>

	<body>
		<div class="loan_nav col_nav">
			<ul>
				<li>
					<a href="javascript:history.go(-1)">
						<i class="iconfont">&#xe61e;</i>
					</a>
				</li>
				<li>
					<p>充值</p>
				</li>
				<li></li>
			</ul>
		</div>
		<div class="interval_T">

		</div>
		<div class="recharge">
			<ul>
				<!-- <li>
					<p>储蓄卡</p>
				</li>
				<li>
					<p @click="showHideOnBlur=true">{{radioValue[0]}}</p>
					<p>单日交易限额¥50000.00</p>
				</li> -->
				<img :src="payUrl" style="width: 100%;"></ul>
			</ul>
		</div>
		<div class="recharge_money">
			<ul>
				<li>
					充值金额：
				</li>
				<li>
					<ul>
						<li>
							<p>
								¥
							</p>
						</li>
						<li>
							<input v-model="money" type="text" >
						</li>
					</ul>
				</li>
				<li>
					订单号：
				</li>
				<li>
					<ul>
						<li>
							
						</li>
						<li>
							<input v-model="params.orderNo" type="text" style="width:100%;font-size:.26rem">
						</li>
					</ul>
				</li>
				<li>
					<input @click="recharge" type="button" value="充值" class="col-green">
				</li>
			</ul>
		</div>
	</body>
</template>

<script>
import { Checklist, XDialog, TransferDomDirective as TransferDom } from 'vux'
export default {
	directives: {
		TransferDom
	},
	components: {
		XDialog,
		Checklist
	},
	created() {
		this.queryPayQrCode()
	},
	methods: {
		queryPayQrCode() {
			this.$http.get('/app/index/payQrCode').then(json => {
				const { code, url } = json
				if(code === 0) {
					this.payUrl = url
				}
			})
		},
		recharge() {
			this.$http.post('/app/recharge/recharge/1', this.params).then(json => {
				const { code } = json
				if (code === 0) {
					this.$vux.toast.show('申请成功')
					this.$router.back()
				}
			})
		}
	},
	data() {
		return {
			// showHideOnBlur: false,
			// commonList: ['工商银行（5264）', '建设银行（5823）', '平安银行（5478）'],
			// radioValue: ['工商银行（5264）'],
			payUrl: null,
			params: {
				amount: '',
				orderNo: ''
			}
		}
	},
	computed: {
		money: {
			get: function () {
				var pattern = /(?=((?!\b)\d{3})+$)/g
				return this.params.amount.replace(pattern, ',')
			},
			set: function (val) {
				this.params.amount = val.replace(/,/g, '')
			}
		}
	}
}
</script>

<style>

</style>